<script setup lang="ts">
const props = defineProps({
  content: {
    type: String,
    default: ''
  },
  confirmText:{
    type: String,
    default: '确认'
  },
  title:{
    type: String,
    default: '提示'
  }
})

const emits = defineEmits(['close', 'confirm'])
const close = ()=>{
  emits('close')
}

const confirm = ()=>{
  emits('confirm')
}
</script>

<template>
  <div class="dialog" @click="close">
    <div class="dialog-box" @click.stop>
      <div class="header">
        <div class="left">
          <img src="~/assets/dialog-icon.png" alt="">
          <span>{{title}}</span>
        </div>
        <img class="close" src="~/assets/modal-close.png" alt="" @click="close">
      </div>
      <div class="dialog-content">
        <p>{{content}}</p>
      </div>
      <div class="footer">
        <span class="btn" @click="close">取消</span>
        <span class="btn" @click="confirm">{{confirmText}}</span>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.dialog {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(25, 30, 40, .4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog-box {
  width: 400px;
  background: #FFFFFF;
  border-radius: 12px 12px 12px 12px;
  padding: 24px;

  .header {
    display: flex;
    align-items: center;
    padding-bottom: 20px;

    .left {
      flex: 1;
      display: flex;
      align-items: center;

      img {
        width: 20px;
        height: 20px;
        margin-right: 4px;
      }

      span {
        font-size: 16px;
        color: #191E28;
        font-weight: bold;
      }
    }

    .close {
      width: 18px;
      height: 18px;
      cursor: pointer;
    }
  }
  .footer{
    display: flex;
    padding: 32px 0 0;
    justify-content: flex-end;
    span{
      width: 92px;
      height: 36px;
      cursor: pointer;
    }
    .btn:nth-child(1){
      background: #FFFFFF;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid rgba(25,30,40,0.08);
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(25,30,40,0.6);
      margin-right: 12px;
    }
    .btn:nth-child(2){
      background: #1DBF73;
      border-radius: 8px 8px 8px 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
    }
  }
  .dialog-content p{
    display: flex;
  }
  .textarea{
    margin-top: 10px;
    textarea{
      width: 100%;
      height: 96px;
      background: rgba(25, 30, 40, 0.02);
      border-radius: 12px 12px 12px 12px;
      border: 1px solid rgba(25, 30, 40, 0.08);
      padding: 16px;
      box-sizing: border-box;
      resize: none;
    }
  }
}
</style>

<style>
.dialog .el-select__wrapper{
  height: 40px;
}
.dialog .el-form--default.el-form--label-top .el-form-item .el-form-item__label{
  color: #191E28;
  font-weight: bold;
}
.tips{
  color: rgba(25,30,40,0.48);
}
</style>